Perl Session 03 - Perl and WWW

Perl Session 03 - Perl and WWW


 

 

 

 

CGI

Common Gateway Interface (CGI) is a standard method for web server software to delegate the generation of web content to executable files. Such files are known as CGI scripts or simply CGIs; they are usually written in a scripting language.

Simple Linkage to CGI Programs

Note two new lines at the end, this separates the HTML body from headers.

 

PSGI/Plack

PSGI or Perl Web Server Gateway Interface is an interface between Perl web applications and web servers, and Plack is a Perl module and toolkit that contains PSGI middleware, helpers and adapters to web servers.

PSGI and Plack are inspired by Python’s WSGI and Ruby’s Rack.

 

 

Perl Web Frameworks


 

 

Catalyst


Catalyst is an open source web application framework written in Perl, that closely follows the model–view–controller (MVC) architecture, and supports a number of experimental web patterns. It is written using Moose, a modern object system for Perl. Its design is heavily inspired by such frameworks as Ruby on Rails, Maypole, and Spring.

Catalyst have native PSGI/Plack support which makes deployment for most webservers a no-brainer.

Sites running Catalyst

Website

http://www.catalystframework.org/

 

 

CGI::Application


Framework for building reusable web-applications. It makes it easier to create sophisticated, high-performance, reusable web-based applications and helps you to make web applications easier to design, write, and evolve.

A mess of modules in CPAN which are “working” with this framework.

Website

http://cgi-app.org/

 

 

Continuity


Continuity is a perl library for building stateful web applications in a style similar to that of command line or desktop applications. The core library is minimalist in nature, staying out of your way much like CGI.pm does. Applications execute as a continuous process on the server, providing advantages similar to mod_perl.

Website

http://continuity.tlt42.org/

 

 

Dancer


Dancer is a simple but powerful web application framework for Perl. Dancer is inspired by Ruby’s Sinatra framework: a framework for building web applications with minimal effort, allowing a simple webapp to be created with very few lines of code, but allowing the flexibility to scale to much more complex applications. Dancer supports plugins to add various extra functionality you may want, whilst keeping the core streamlined.

Key features

Website

 

 

HTTP::Engine


Web Server Gateway Interface and HTTP Server Engine Drivers.

HTTP::Engine abstracts handling the input and output of various web server environments, including CGI, mod_perl and FastCGI. Most of the code is ported over from Catalyst::Engine.

Website

http://search.cpan.org/~yappo/HTTP-Engine-0.03005/lib/HTTP/Engine.pm

 

 

HTML::Mason 1 and 2


Version 1 of Mason (HTML::Mason) has been around since 1998

Mason is a powerful Perl-based templating system for generating HTML or other dynamic content. It has powered thousands of web sites over the past 15 years, including Amazon.com and Salon.com.

Poet is a modern companion web framework for Mason. It uses PSGI/Plack for server integration and a selection of best-of-breed CPAN modules for caching, logging and configuration.

Key Features:

Sites running Mason

Amazon.com, Delicious.com, Rent.com, Dyn.com, HearstMags.com, Salon.com, Shutterstock.com

Website

http://www.masonhq.com/

 

 

Maypole


MVC web application framework

Maypole is a Perl web application framework similar to Java’s Struts. It is essentially completely abstracted, and so doesn’t know anything about how to talk to the outside world. To use it, you need to create a driver package which represents your entire application.

This needs to first use Maypole::Application which will make your package inherit from the appropriate platform driver such as Apache::MVC or CGI::Maypole. Then, the driver calls setup. This sets up the model classes and configures your application. The default model class for Maypole uses Class::DBI to map a database to classes, but this can be changed by altering configuration.

Website

http://search.cpan.org/~teejay/Maypole-2.13/lib/Maypole.pm

 

 

Mojolicious


A next generation web framework for the Perl programming language.

Back in the early days of the web, many people learned Perl because of a wonderful Perl library called CGI. It was simple enough to get started without knowing much about the language and powerful enough to keep you going, learning by doing was much fun. While most of the techniques used are outdated now, the idea behind it is not. Mojolicious is a new attempt at implementing this idea using state of the art technology.

Key Features

Website

http://mojolicio.us/ https://github.com/kraih/mojo

 

 

Piglet


PSGI micro web framework toolkit

Piglet is a DIY toolkit for web application and web framework developers. Piglet is a collection of modules, utilities and helpers to make it easier than ever to create a new micro web framework, or add new features to existing frameworks.

Piglet is inpired by Sinatra, Merb, routes, Ruby on Rails, WebOb, juno, bottle, Dancer and Mojolicious.

Website

https://github.com/miyagawa/Piglet

 

 

Squatting


A Camping-inspired Web Microframework for Perl.

https://github.com/beppu/squatting

 

 

Tatsumaki


Non-blocking web framework based on Plack and AnyEvent

Tatsumaki is a toy port of Tornado for Perl using Plack (with non-blocking extensions) and AnyEvent.

It allows you to write a web application that does a immediate response with template rendering, IO-bound delayed response (like fetching third party API or XML feeds), server push streaming and long-poll Comet in a clean unified API.

Website

https://github.com/miyagawa/Tatsumaki

 

 

Choosing a framework


Popularity and community size

The more well-known and recognized the framework is, the more it will be “living,” evolving and complete.

Philosophy

A tool developed by professionals for their own needs will obviously meet the demands of other professionals.

Sustainability

Before choosing a framework, make sure that it will be able to keep up with you for the duration.

Support

Another criterion that should not be overlooked is the ease of finding answers to your questions and getting help.

Technique

One that respects best practices in terms of development (design patterns).

Security

Any application is potentially vulnerable.

Documentation

A well-documented tool is both easier to use and more upgradeable.

License

Licenses are important simply because they can have a significant impact on your applications.

Availability of resources on the market

Make sure that the skills required for the tool that you are using are available on the open market.

 

 

 

Thank You!